/**
  @file: TestDomainDefinition.java
  
   PURPOSE:
      This tests DomainDefinition, parsing either logical or physical XML
      definition files. This only tests the parsing and resulting objects.
   
   @author Ron Williams
  
   REVISION HISTORY ABSTRACT
  
   PROGRAMMER:  Ron Williams ORG: MSE
  
   Copyright 2011 Mission Solutions LLC. All rights reserved.
  
   END ABSTRACT
 */

package com.mse.utilities;

import java.lang.String;
import java.lang.System;
import java.util.Properties;

import com.mse.utilities.DomainDefinition;
import com.mse.utilities.DomainException;
import com.mse.utilities.UtilityException;
import com.mse.utilities.Log;
import com.mse.utilities.Settings;

/**
   DESCRIPTION:
      The TestDomainDefinition class contains the information as a result of 
      parsing a Domain Definition file.
 */
public class TestDomainDefinition {

   /**
      DESCRIPTION:
         Create a TestDomainDefinition object to test a Domain Definition
         in the specified input file. 

      @param domDefPath - path to a domain definition file to parse and load
      @return void
      @throws DomainException
    */
   public TestDomainDefinition(String domDefPath) throws DomainException {

      DD = new DomainDefinition(domDefPath);
   }


   /**
      DESCRIPTION:
         Main program

      @param args - first arg must be path to XML Domain Definition file.
      @return void
      @throws DomainException
    */
   public static void main(String[] args) {
      try {
         // we MUST initialize Setting and Log or they will crash...
         Properties myProps = new Properties();

         // Log levels: OFF,ERROR,WARNING,INFO,DEBUG
         myProps.setProperty("log.level", "DEBUG");
         //myProps.setProperty("log.level", "INFO");
         myProps.setProperty("log.consoleEnabled", "true");
         myProps.setProperty("log.fileEnabled", "false");
         myProps.setProperty("log.fileLimit", "1000");
         myProps.setProperty("log.fileCount", "2");
         myProps.setProperty("log.filePattern", "./domainTestLog.%g.log");
         myProps.setProperty("log.fileAppend", "false");

         // initialization order matters
         Settings.init(myProps);
         //Log.init();

         if (args.length == 1) {
            TestDomainDefinition tdd = new TestDomainDefinition(args[0]);
         } else {
            System.out.println("\nUSAGE: requires one argument, the path to "+
                               "Domain Definition file\n");
         }

      } catch (DomainException de) {
         System.out.println(de.toString());
      } catch (UtilityException e) {
         System.out.println("*** Failed initialization, reason: " +
                            e.toString());
      }
   }
	public DomainDefinition getDD(){
		return DD;
	}
	private DomainDefinition DD;
}

